<template>
    <div class="app-container towSearchHeader">
        <div class="customContainer">
            <!-- 头 -->
            <div class="customHeader fSize18 text-center">
                <div>{{time}} {{store_name}}日报详情</div>
            </div>
            <!-- 权限tap标签分类 -->
            <el-tabs v-model="formInline.type" @tab-click="handleClick">
                <el-tab-pane label="机台出货" name="1"></el-tab-pane>
            </el-tabs>
            <!-- 列表 -->
            <el-table highlight-current-row :data="list" v-loading.body="listLoading" border fit size="small">
                <el-table-column align="center" label="区域号" prop="area_name"></el-table-column>
                <el-table-column align="center" label="机台号" prop="mno"></el-table-column>
                <el-table-column align="center" label='机台类型' prop="type_name"></el-table-column>
                <el-table-column align="center" label="礼品名称" prop="gift_name"></el-table-column>
                <el-table-column align="center" label='神采礼品编号' prop="gift_no_obsolete"></el-table-column>
                <el-table-column align="center" label="新礼品编号" prop="gift_id"></el-table-column>
                <el-table-column align="center" label='盘点数（个）' prop="check_num"></el-table-column>
                <el-table-column align="center" label='出货数（个）' prop="unitsshipped"></el-table-column>
            </el-table>
        </div>

    </div>
</template>

<script>
    import {
        getList,
    } from "@/api/storage_control/storeDay_ditail";
    export default {
        data() {
            return {
                list: null,
                listLoading: false,
                store_name: '',
                time: '',
                formInline: {
                    store_id: this.$route.params.store_id,
                    type: '1',
                    begin_time: this.$route.params.time,
                    end_time: this.$route.params.time,
                },
            }
        },
        watch: {
            '$route'(to, from) {
                if (this.$route.params.store_id) {
                    this.formInline.begin_time = this.$route.params.time;
                    this.formInline.end_time = this.$route.params.time;
                    this.formInline.store_id = this.$route.params.store_id
                    this.fetchData();
                }
            }
        },
        created() {
            this.fetchData();
        },
        methods: {
            handleClick(tab, event) {
                this.fetchData()
            },
            // 列表获取
            fetchData() {
                this.listLoading = true;
                getList(this.formInline).then(response => {
                    this.list = response.list;
                    this.store_name = response.store_name;
                    this.time = response.time;
                    this.listLoading = false;
                }).catch(res=>{
                    this.listLoading=false;
                })
            },
        }
    };
</script>